Add EPP in-flight requests and tokens metrics (#1089)#1697
Conversation
| limitations under the License. | ||
| */ | ||
|
|
||
| package collectors |
There was a problem hiding this comment.
The metric should be owned and updated by the inflight load producer plugin. See as an example the metrics owned and emitted by the disagg handler: pkg/epp/framework/plugins/scheduling/profilehandler/disagg/metrics.go
Implements llm-d#1089 (xref GAIE llm-d#2072): EPP in-flight observability, owned by the in-flight load producer plugin. - Per-endpoint llm_d_epp_inflight_requests / llm_d_epp_inflight_tokens gauges via a custom prometheus.Collector reading the InFlightLoadProducer snapshot. Registered through the plugin metrics recorder (handle.Metrics()) with producer_name as a constant descriptor label, so multiple producers register without collision. - Per-model llm_d_epp_request_inflight gauge owned by the producer: incremented in PreRequest, decremented exactly once via a per-request PluginState entry's OnEvicted, so it stays balanced across completion, error, abort, and reaper paths. Mirrors the metric-ownership pattern of the disagg handler (profilehandler/disagg/metrics.go). - Adds InferenceRequest.IncomingModel so the producer can label the gauge with the incoming model name. - docs/metrics.md documents all three metrics. Fixes llm-d#1089 Signed-off-by: ChethanUK <chethanuk@outlook.com>
5160bf7 to
62ee968
Compare
Resolve the InFlightLoadProducerFactory conflict in inflightload's producer.go. main added output-ratio and max-estimated-output-token validation ahead of construction, while this branch switched the constructor to a named producer variable so the in-flight metrics collector can be registered against the producer before returning. Keep both behaviors: validate the config first, then build through the named variable so metric ownership stays inside the producer plugin and the new output-token caps are still enforced. Signed-off-by: ChethanUK <chethanuk@outlook.com>
There was a problem hiding this comment.
nit: these two wording changes are unrelated to the rest of the PR.
|
Please rebase on main to pick up fixes for failing tests. |
|
Rebased please merge |
|
|
||
| package collectors | ||
|
|
||
| import ( |
There was a problem hiding this comment.
I don't believe we need this file at all
There was a problem hiding this comment.
Removed. The per-endpoint metrics are now plain gauges owned by the producer in inflightload/metrics.go, no custom collector.
| return p.requestTracker.get(eid) | ||
| } | ||
|
|
||
| // InFlightRequestsSnapshot returns a copy of the per-endpoint in-flight request |
There was a problem hiding this comment.
I am not sure we need any of this, can't we just define the metrics as guages and update them in every place were tokenCounter and requestCounter are updated?
There was a problem hiding this comment.
Done. Dropped the snapshot methods and the collector; the gauges are now set from the live counter value at every point the request/token counters change (admission, release/eviction, endpoint removal deletes the series). Setting from the live value rather than mirroring inc/dec keeps the gauge correct when a late release lands on an orphaned counter after an endpoint delete/recreate, and it can never go negative.
Signed-off-by: ChethanUK <chethanuk@outlook.com>
|
@ahg-g Please review when you got time thanks |
Summary
Implements #1089 (xref upstream GAIE kubernetes-sigs/gateway-api-inference-extension#2072): EPP observability for in-flight requests and tokens. Adds two complementary signals:
llm_d_epp_inflight_requestsandllm_d_epp_inflight_tokens, gauges labelledendpoint_name,namespace,producer_name, sourced from theInFlightLoadProducer's live per-endpoint request/token trackers via a customprometheus.Collector(mirrorspkg/epp/metrics/collectors/inference_pool.go, the GAIE per-pod-queue-size pattern). This answers "which replica is loaded", matching docs/configs: replace deprecated maxPrefixBlocksToMatch and blockSize with maxPrefixTokensToMatch and blockSizeTokens #2072's per-pod intent.llm_d_epp_request_inflight, a sibling ofrequest_runninglabelledmodel_name,target_model_name,fairness_id,priority, capturing the full admitted->completed window inside the EPP.What
Per-endpoint collector (
inflight_requests/inflight_tokens):pkg/epp/metrics/collectors/inflight_load.go—Collectemits one const gauge per endpoint fromrequestTracker.snapshot()/tokenTracker.snapshot(); no double-counting, cleanup follows the producer's endpoint lifecycle.tokens= uncached prompt tokens, optionally plus estimated output when the producer'saddEstimatedOutputTokensis set.InFlightLoadProducerself-registers the collector at construction (no startup-ordering hook); it no-ops when the plugin is not configured.producer_namelabel keeps series distinct and collision-free when multiple producers are configured.Per-model gauge (
request_inflight):Director.HandleRequestsucceeds, where model/priority/fairness labels are populated).Processdefer, guaranteed on error/disconnect/panic paths (guarded byRequestContext.RequestInflight).request_ttft_secondspattern.Why
request_runningis incremented only at dispatch, so it misses the in-EPP parse/admit/schedule window; the per-modelrequest_inflightcaptures the full admitted->completed window. The per-endpointinflight_requests/inflight_tokensexpose per-replica queue depth and token pressure — the load-aware-routing signal #1089/#2072 are about — from data theInFlightLoadProduceralready maintains (previously visible only via/debug/plugins/stateand the token-load scorer).Testing
make test-filter PATTERN=TestInflightRequestsMetrics TYPE=eppand the newTestInFlightLoadCollector*tests (golden output).make test: epp + sidecar unit suites with-race, GAIE e2e, scheduler e2e — all pass.make lint(0 issues),go build/go vet/gofmtclean.docs/metrics.mddocuments all three metrics.Fixes #1089